# 循环 Loop
# for 循环 For Loop
# while 循环 While Loop

# for 循环，就是遍历一个序列中的所有值

# # 遍历列表中的元素
# fruits = ['apple', 'banana', 'cherry']
# for i in fruits:
#     print(i)
#

# # 遍历字符串中的字符
# name = "Shawn Holmes Hu!"
# for j in name:
#     print(j)

# # 遍历一个范围
# a = range(1, 11) # range(start, stop)
# print(type(a)) # <class 'range'>
# for k in a: # range(1, 11) 生成一个从1到10的序列
#     print(k) # 1 2 3 4 5 6 7 8 9 10

# # 遍历出0-100之间的所有偶数
# for i in range(101):
#     if i % 2 == 0:
#         print(i)


# result = 0
# for i in range(0, 101, 2):
#     result += i
# print(result)

# # 拼接0-100之间的所有偶数
# my_string = ""
# print(type(my_string))
#
# for i in range(101):
#     if i % 2 == 0 and i != 44:
#             my_string += str(i) + ", "
# print(my_string)

# # 计算1-100之间的所有整数和
# result = 0
# for i in range(1, 1001):
#     result += i
# print(result)

# # 打印九九乘法表
# for i in range(1, 10):
#     for j in range(1, i + 1):
#         print(f"{j} * {i} = {i * j}", end="\t")
#     print()

"""
FizzBuzz游戏规则
所有人围成一个圈
从1开始报数，每报到3的倍数的人就要说Fizz
每报到5的倍数的人就要说Buzz
同时是3和5的倍数的人要说FizzBuzz
"""
# for i in range(1, 101): # 1-100
#     if i % 3 == 0 and i % 5 == 0: # 同时是3和5的倍数
#         print("FizzBuzz")
#     elif i % 5 == 0: # 是5的倍数
#         print("Buzz")
#     elif i % 3 == 0: # 是3的倍数
#         print("Fizz")
#     else:
#         print(i)